Problem Note 35458: Data set named in hash OUTPUT method must not be used elsewhere in same DATA step
Data set named in hash OUTPUT method must not be used elsewhere in same DATA step.
When the OUTPUT method writes to the named SAS data set, it places an exclusive lock on the name. If the DATA step refers to the same data set name, the OUTPUT method cannot close the data set. This error is not passed back to the user.
The work-around is to not use the same SAS data set name on the DATA, SET or OUTPUT statements or OPEN function in the DATA step.
Operating System and Release Information
SAS System | Base SAS | 64-bit Enabled AIX | 9.1 TS1M3 | 9.3 TS1M0 |
Windows Vista | 9.1 TS1M3 | 9.3 TS1M0 |
Microsoft Windows XP Professional | 9.1 TS1M3 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 | 9.3 TS1M0 |
Microsoft Windows NT Workstation | 9.1 TS1M3 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 | |
Microsoft Windows 2000 Server | 9.1 TS1M3 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 | |
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 | 9.3 TS1M0 |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 | 9.3 TS1M0 |
z/OS | 9.1 TS1M3 | 9.3 TS1M0 |
64-bit Enabled HP-UX | 9.1 TS1M3 | 9.3 TS1M0 |
64-bit Enabled Solaris | 9.1 TS1M3 | 9.3 TS1M0 |
HP-UX IPF | 9.1 TS1M3 | 9.3 TS1M0 |
Linux | 9.1 TS1M3 | 9.3 TS1M0 |
OpenVMS Alpha | 9.1 TS1M3 | 9.3 TS1M0 |
Tru64 UNIX | 9.1 TS1M3 | 9.3 TS1M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
To demonstrate the problem, run the code in Scenario PROBLEM below. You will see no change in the output data set CLASS.
To demonstrate the work-around, run the code in Scenario WORKAROUND below. The CLASS_NEW data set has only 3 variables.
/* Scenario PROBLEM */
data class; set sashelp.class; run;
data _null_;
if 0 then set class;
declare hash h(dataset:'class');
h.defineKey('name');
h.defineData('name', 'height', 'weight');
h.defineDone();
h.output(dataset:'class');
stop;
run;
proc print data=class;
title 'Input data set'; run;
/* Scenario PROBLEM */
data class; set sashelp.class; run;
data _null_;
if 0 then set class;
declare hash h(dataset:'class');
h.defineKey('name');
h.defineData('name', 'height', 'weight');
h.defineDone();
h.output(dataset:'class');
stop;
run;
proc print data=class;
title 'Demonstrate problem'; run;
/* Scenario WORKAROUND */
data class; set sashelp.class; run;
data _null_;
if 0 then set class;
declare hash h(dataset:'class');
h.defineKey('name');
h.defineData('name', 'height', 'weight');
h.defineDone();
h.output(dataset:'class_NEW');
stop;
run;
proc print data=class_NEW;
title 'Demonstrate work-around'; run;
Input data set 1
Obs Name Sex Age Height Weight
1 Alfred M 14 69.0 112.5
2 Alice F 13 56.5 84.0
3 Barbara F 13 65.3 98.0
4 Carol F 14 62.8 102.5
5 Henry M 14 63.5 102.5
6 James M 12 57.3 83.0
7 Jane F 12 59.8 84.5
8 Janet F 15 62.5 112.5
9 Jeffrey M 13 62.5 84.0
10 John M 12 59.0 99.5
11 Joyce F 11 51.3 50.5
12 Judy F 14 64.3 90.0
13 Louise F 12 56.3 77.0
14 Mary F 15 66.5 112.0
15 Philip M 16 72.0 150.0
16 Robert M 12 64.8 128.0
17 Ronald M 15 67.0 133.0
18 Thomas M 11 57.5 85.0
19 William M 15 66.5 112.0
Demonstrate problem 2
Obs Name Sex Age Height Weight
1 Alfred M 14 69.0 112.5
2 Alice F 13 56.5 84.0
3 Barbara F 13 65.3 98.0
4 Carol F 14 62.8 102.5
5 Henry M 14 63.5 102.5
6 James M 12 57.3 83.0
7 Jane F 12 59.8 84.5
8 Janet F 15 62.5 112.5
9 Jeffrey M 13 62.5 84.0
10 John M 12 59.0 99.5
11 Joyce F 11 51.3 50.5
12 Judy F 14 64.3 90.0
13 Louise F 12 56.3 77.0
14 Mary F 15 66.5 112.0
15 Philip M 16 72.0 150.0
16 Robert M 12 64.8 128.0
17 Ronald M 15 67.0 133.0
18 Thomas M 11 57.5 85.0
19 William M 15 66.5 112.0
Demonstrate work-around 3
Obs Name Height Weight
1 John 59.0 99.5
2 Alice 56.5 84.0
3 Henry 63.5 102.5
4 Joyce 51.3 50.5
5 Janet 62.5 112.5
6 Judy 64.3 90.0
7 William 66.5 112.0
8 Mary 66.5 112.0
9 James 57.3 83.0
10 Barbara 65.3 98.0
11 Carol 62.8 102.5
12 Ronald 67.0 133.0
13 Louise 56.3 77.0
14 Thomas 57.5 85.0
15 Alfred 69.0 112.5
16 Robert 64.8 128.0
17 Jane 59.8 84.5
18 Philip 72.0 150.0
19 Jeffrey 62.5 84.0
Type: | Problem Note |
Priority: | medium |
Topic: | SAS Reference ==> Component Objects ==> hash object ==> OUTPUT SAS Reference ==> Component Objects ==> hash object
|
Date Modified: | 2011-06-01 13:07:59 |
Date Created: | 2009-04-03 17:02:58 |